﻿using System;
using System.Collections.Generic;

using System.Text;
using Microsoft.SharePoint.Administration;
using MFD.SharePoint.SPBackup.Properties;

namespace MFD.SharePoint.SPBackup
{
    class Program
    {
        static void Main(string[] args)
        {
            
            Logger loger = new Logger();

            SPFarm farm = SPFarm.Local;
            
            
            bool success=MFDSPBackup.BackupAllSites(farm,loger);
            
            //send report email.
            if (success)
            {
                string subject = string.Format("Backup Succeded for {0}",Settings.Default.FarmName);
                MFDSPBackup.SendEmail(subject,loger);
            }
            else
            {

                string subject = string.Format("Backup Failed for {0}", Settings.Default.FarmName);
                MFDSPBackup.SendEmail(subject,loger);
            }
        }
    }
}
